<?php
Route::group(['prefix' => config('constant.name_admin'), 'middleware' => ['auth:admin', 'checkrbac','checktoken',"XSS"]], function() {
    //结果录入
    Route::group(['prefix' => 'itemData'], function() {
        Route::any('station', 'Admin\ItemDataController@station'); //检测设备列表
        Route::any('temHuiPreIndex', 'Admin\ItemDataController@temHuiPreIndex'); //温湿度气压计
        Route::any('bindThirdItem', 'Admin\ItemDataController@bindThirdItem'); //绑定内网项目code
        Route::post('bindUploadKey', 'Admin\ItemDataController@bindUploadKey'); //绑定内网项目中的试验数据key
    });

    //检测设备
    Route::group(['prefix' => 'station'], function() {
        Route::get('index', 'Admin\StationController@index'); //展示
        Route::get('del', 'Admin\StationController@del'); //删除
        Route::any('add', 'Admin\StationController@add'); //添加
        Route::any('edit', 'Admin\StationController@edit'); //修改
        Route::get('upParam', 'Admin\StationController@upParam'); //设备软件数据-列表
        Route::post('upParam', 'Admin\StationController@upParam'); //设备软件数据-添加、编辑
    });

    //录像机
    Route::group(['prefix' => 'vcr'], function() {
        Route::get('index', 'Admin\VcrController@index'); //展示
        Route::get('del', 'Admin\VcrController@del'); //删除
        Route::any('add', 'Admin\VcrController@add'); //添加
        Route::any('edit', 'Admin\VcrController@edit'); //修改
        Route::any('live', 'Admin\VcrController@live'); //预览
        Route::any('ysyAdd', 'Admin\VcrController@ysyAdd'); //同步到萤石云
    });

    //城市
    Route::group(['prefix' => 'city_code'], function() {
        Route::get('index', 'Admin\CityCodeController@index'); //展示
        Route::get('del', 'Admin\CityCodeController@del'); //删除
        Route::any('add', 'Admin\CityCodeController@add'); //添加
        Route::any('edit', 'Admin\CityCodeController@edit'); //修改
    });

    Route::group(['prefix' => 'statistics'], function() {
        Route::any('statisticsByClient', 'Admin\StatisticsController@statisticsByClient');       //合格数量 与 不合格数量 -- 按送检单位统计
        Route::any('statisticsByToolClass', 'Admin\StatisticsController@statisticsByToolClass'); ////合格数量 与 不合格数量 -- 按工器具分类统计
        Route::any('statisticsByTool', 'Admin\StatisticsController@statisticsByTool');           //按工器具统计
        Route::any('statisticsByManager', 'Admin\StatisticsController@byManager');           //按主捡人工作量统计
    });
    Route::group(['prefix' => 'contractGaiyao'], function() {
        Route::get('getThirdDj', 'Admin\ContractGaiyaoController@getThirdDj');  //获取第三方待检样品
        // Route::any('getThirdGqj', 'Admin\ContractGaiyaoController@getThirdGqj');  //获取第三方待检样品
        Route::any('edit/{id}', 'Admin\ContractGaiyaoController@edit');  //合同样品编辑
        Route::any('ajaxEditBarcode/{id}/{numcha}/{barcodes}', 'Admin\ContractGaiyaoController@ajaxEditBarcode'); //合同样品编辑条形码
        Route::any('changeStd', 'Admin\ContractGaiyaoController@changeStdAjax');  //切换工器具标准
        Route::any('addItem', 'Admin\ContractGaiyaoController@addItem'); //添加检测项目
        Route::any('changeClass', 'Admin\ContractGaiyaoController@changeClassAjax');   //修改分类
//        批量结果录入
        Route::group(['prefix' => 'resLuru'], function() {
            Route::get('{contract_id}', 'Admin\ContractGaiyaoController@resLuru'); //列表
            // Route::post('itemData', 'Admin\ContractGaiyaoController@itemData'); //获取单项目信息(转移到只需登录，不需要验证权限组)
            Route::post('itemDataSub', 'Admin\ContractGaiyaoController@itemDataSub'); //提交单项目信息
        });
    });
    Route::group(['prefix' => 'contract'], function() {
        Route::get('exportBack/{id}', 'Admin\ContractController@exportBack'); //导出Excel
        Route::get('indexPay', 'Admin\ContractController@indexPay');          //支付操作列表
        Route::any('goPay/{id}', 'Admin\ContractController@goPay');           //支付操作
        Route::get('expire', 'Admin\ContractController@expire'); //到期预警
        Route::get('exportFF', 'Admin\ContractController@exportFF'); //下载分发单
        //委托单来源
        Route::group(['prefix' => 'letter'], function() {
            Route::get('index', 'Admin\ContractLetterController@index');  //列表
        });
    });
    Route::group(['prefix' => 'sampleinfo'], function() {
        Route::any('notNotice/{barCode}', 'Admin\SampleInfoController@notNotice');                 //不再提醒预警到期
        Route::any('list', 'Admin\SampleInfoController@list');                                     //试验台账列表
        Route::get('imgdeal/{column}/{operate}/{bar_code}', 'Admin\SampleInfoController@imgdeal'); //不合格照片删除
        //备注模板
        Route::group(['prefix' => 'remark'], function() {
            Route::any('list', 'Admin\SampleInfoController@remarkList'); //列表
            Route::any('add', 'Admin\SampleInfoController@remarkAdd');   //添加
            Route::any('del', 'Admin\SampleInfoController@remarkDel');   //添加
        });
        Route::any('exportList/{isSearch}', 'Admin\SampleInfoController@exportList');      //试验完成导出
        Route::any('rejectLog/{iscontract}/{id}', 'Admin\SampleInfoController@rejectLog'); //驳回记录
        Route::any('printPass', 'Admin\SampleInfoController@printPass'); //自定义合格证打印
    });
    Route::group(['prefix' => 'sampleInfo'], function() {
        Route::get('gqjPlate', 'Admin\SampleInfoController@gqjPlate'); //获取铭牌信息
    });

    Route::group(['prefix' => 'setting'], function() {
        Route::any('testPlace/{func}/{val}', 'Admin\SettingController@testPlace'); //试验地点
        Route::any('warn_day_limit', 'Admin\SettingController@warnDaysLimit');     //预警时间设置
        Route::any('settingSys/{key}', 'Admin\SettingController@settingSys');      //系统设置
        // Route::get('backUp', 'Admin\SettingController@backUp');      //数据库备份(转移到只需登录，不需要验证权限组)
    });

    Route::group(['prefix' => 'tool'], function() {
        Route::get('toolPlate', 'Admin\ToolController@toolPlate'); //铭牌信息
        Route::post('toolPlate/add', 'Admin\ToolController@toolPlate'); //铭牌信息-添加
        //工器具分类
        Route::group(['prefix' => 'class'], function() {
            Route::any('index', 'Admin\ToolClassController@index'); //列表
            Route::any('del', 'Admin\ToolClassController@del');     //删除
        });
    });
    Route::group(['prefix' => 'stdToolItemRel'], function() {
        Route::any('sort', 'Admin\StdToolItemRelController@sort'); //自动根据ID排序
    });

    Route::group(['prefix' => 'testdataKey'], function() {
        Route::get('hide', 'Admin\TestdataKeyController@hide');   //隐藏数据标题
        Route::put('dataTitle', 'Admin\TestdataKeyController@dataTitle');                                 //关联数据标题
        Route::any('relation', 'Admin\TestdataKeyController@relation');                                 //关联数据标题
        Route::get('relation/del', 'Admin\TestdataKeyController@del');                                  //数据标题 删除
        Route::post('relation/saveSortTestdataKey', 'Admin\TestdataKeyController@saveSortTestdataKey'); //保存排序 试验数据标题
    });
    Route::group(['prefix' => 'clientCode'], function() {
        Route::group(['prefix' => 'class'], function() {
            Route::any('index', 'Admin\ClientCodeController@classIndex');
            Route::any('del', 'Admin\ClientCodeController@classDel');
        });
    });

    //不合格照片、斗臂车照片
    Route::group(['prefix' => 'photo'], function() {
        Route::any('list', 'Admin\SampleInfoController@photoList'); //列表
	    Route::any('list/sub', 'Admin\SampleInfoController@photoListSub'); //提交
    });

    //微信jssdk
    Route::group(['prefix' => 'wxjssdk'], function() {
        Route::any('getSignPack', 'WeChatJSSDK@getSignPackage');
    });

    //报告模板
    Route::group(['prefix' => 'excelPos'], function() {
        Route::any('getExcelPos', 'Admin\ExcelPosController@excelPosAjax');
        Route::any('getExcelPosDetail', 'Admin\ExcelPosController@excelPosDetailAjax');
        Route::post('syncPos', 'Admin\ExcelPosController@syncPos'); //同步位置
    });

    //生产厂家
    Route::group(['prefix' => 'factory'], function() {
        Route::any('index', 'Admin\FactoryController@index');
        Route::any('edit', 'Admin\FactoryController@edit');
        Route::any('del', 'Admin\FactoryController@del');
    });

    //通知
    Route::group(['prefix' => 'notice'], function() {
        //阿里大于短信
        Route::group(['prefix' => 'sms'], function() {
            Route::any('index', 'Admin\SmsController@index');
            Route::any('set', 'Admin\SmsController@set');
            Route::any('detail/{id}', 'Admin\SmsController@detail');
            Route::any('del', 'Admin\SmsController@del');
            Route::any('sendOne', 'Admin\SmsController@sendOne');   //重新发送短信
            //购买
            Route::group(['prefix' => 'buy'], function() {
                Route::any('index', 'Admin\SmsController@buyIndex');                //购买记录
                Route::any('add', 'Admin\SmsController@buyAdd');                    //添加
                Route::any('del/{id}', 'Admin\SmsController@buyDel');               //删除
                Route::any('audit/{id}/{stat}', 'Admin\SmsController@buyAudit');    //审核
            });
            //签名
            Route::group(['prefix' => 'sign'], function() {
                Route::any('index', 'Admin\SmsController@signIndex');           //签名记录
                Route::any('add', 'Admin\SmsController@signAdd');               //添加
                Route::any('edit/{id}', 'Admin\SmsController@signEdit');             //修改
                Route::any('del/{id}', 'Admin\SmsController@signDel');          //删除
                Route::any('def/{id}', 'Admin\SmsController@signDef');          //设置默认
                Route::any('detail/{id}', 'Admin\SmsController@signDetail');    //审核详情
            });
            //工器具
            Route::group(['prefix' => 'gqj'], function() {
                Route::any('set', 'Admin\SmsController@gqjSet'); //通知规则设置
            });
        });
    });
});
//app
Route::get('/' . config('constant.name_admin') . '/app/login', 'App\PublicController@login')->name('loginApp'); //登录
Route::group(['prefix' => config('constant.name_admin').'/app'], function() {
	Route::any('/', 'App\PublicController@index'); //首页
	Route::any('index', 'App\PublicController@index')->name('appIndex'); //首页
    Route::any('login', 'App\PublicController@login'); //登录
	Route::any('scan/list', 'App\PublicController@scanList')->name('appScanList'); //扫描页列表
	Route::any('photo', 'App\PublicController@photo')->name('appPhoto'); //不合格照片、斗臂车
	Route::any('scan/contract', 'App\PublicController@contract')->name('contract'); //受理批次
	Route::post('scan/gaiyao', 'App\PublicController@gaiyao')->name('contractGaiyao'); //提交受理
});

Route::group(['prefix' => config('constant.name_admin'), 'middleware' => ['auth:admin']], function() {
    Route::get('exportReport/origin', 'Admin\ExportReportController@origin'); //导出原始记录
    Route::group(['prefix' => 'contractGaiyao'], function() {
//        批量结果录入
        Route::group(['prefix' => 'resLuru'], function() {
            Route::post('itemData', 'Admin\ContractGaiyaoController@itemData'); //获取单项目信息
        });
    });
    Route::group(['prefix' => 'setting'], function() {
        Route::get('backUp', 'Admin\SettingController@backUp');      //数据库备份
    });
    //LED智慧实验室中控室
    Route::group(['prefix' => 'zks'], function() {
        Route::any('index', 'Admin\ZksController@index'); //展示
        Route::get('user/{id}', 'Admin\ZksController@manager'); //管理员
        Route::get('client/{id}', 'Admin\ZksController@client'); //客户
        Route::get('contract/{id}', 'Admin\ZksController@contract'); //批次
        Route::get('expire/{clientName}', 'Admin\ZksController@expire'); //到期
        Route::get('station/{id}', 'Admin\ZksController@station'); //设备
        Route::get('hb6303/{id}', 'Admin\ZksController@hb6303'); //温湿度大气压设备详情
        Route::get('tester/{id}', 'Admin\ZksController@tester'); //今日主检工作量
        Route::get('vcr/{lanip}', 'Admin\ZksController@vcr'); //录像机
        Route::post('setOrder', 'Admin\ZksController@setOrder'); //设置排序
        Route::get('getEnvInfo', 'Admin\ZksController@getEnvInfo'); //请求环境数据
        Route::any('getContent', 'Admin\ZksController@getContent'); //请求列表数据
        Route::any('month/{id}', 'Admin\ZksController@getMonthContent'); //请求列表数据

    });
});
//Route::any('/services/OutBoundService', 'Admin\ThirdController@autoData');  //第三方系统对接-风控调用接口
Route::any('print', 'Admin\SampleInfoController@printPass'); //展示
//Route::any('/services/OutBoundService', 'Admin\SoapCallbackController@soapFun'); //这里返回wsdl文件，没有会生成
Route::group(['middleware' => ['addOperateLog']], function() {
    Route::any('/services/OutBoundService', 'Admin\SoapCallbackController@soapFun'); //这里返回wsdl文件，没有会生成
    Route::any('/services/TjOutBoundService', 'Admin\SoapCallbackController@TjsoapFun'); //这里返回wsdl文件，没有会生成
});
